package gamedb

import (
	isql "game/game-db/mysql/sql"
	"game/game-db/orm"
	"game/game-db/orm/meta"
)

type IDao[T orm.IDbEntity] interface {
	Sql(entity T) isql.ISql
	EntityMeta() meta.IEntityMeta

	Insert(entity T) error
	InsertAll(entities []T)
	Update(entity T)
	UpdateAll(entities []T)
	Delete(entity T)
	DeleteAll(entities []T)

	TableName() string
	GetByPrimaryKey(key interface{}) (T, bool)
	QueryWhere(where string, args ...interface{}) []T

	All() []T
}
